<template>
  <j-modal title="管控计划" :width="700" :visible="visible" :footer="null" switchFullscreen @cancel="handleCancel" @ok="handleOk">
    <p style="font-weight: bold;">常规尿液检测</p>
    <div>
      <p> 第一年 <span class="b1"> {{ infoObj1.rulesOne }}</span>；</p>
      <p> 第一年 <span class="b1"> {{ infoObj1.rulesTwo }}</span>；</p>
      <p> 第一年 <span class="b1"> {{ infoObj1.rulesThree }}</span>；</p>
      <p> 共需要做<span class="b1"> {{ infoObj1.urineTotal }}</span> 次常规尿液检测,已完成<span class="b1"> {{
          infoObj1.completeCount
      }}</span>次，已取消<span class="b1"> {{ infoObj1.cancelTotal }}</span> 次，补录<span class="b1"> {{
    infoObj1.collectionCount
}}</span> 次，免除<span class="b1"> {{ infoObj1.notDetectionCount }}</span> 次，待开始<span class="b1"> {{
    infoObj1.waitBeginCount
}}</span> 次</p>
    </div>
    <p class="pt">突击尿液检测</p>
    <div>
      <p><span class="b1"> {{ infoObj2.assaultTime }}，</span></p>
      <p> 共需要做<span class="b1"> {{ infoObj2.urineTotal }}</span> 次突击尿液检测，已完成<span class="b1"> {{
          infoObj2.completeCount
      }}</span>次，已取消<span class="b1"> {{ infoObj2.cancelTotal }}</span> 次，待完成<span class="b1"> {{
    infoObj2.waitBeginCount
}}</span> 次</p>
    </div>
    <p class="pt">定期访谈</p>
    <div>
      <p><span class="b1">{{ infoObj3.detectTime }}</span>； </p>
      <p> 共需要做 <span class="b1"> {{ infoObj3.detectTotal }} </span> 次定期访谈；已完成
        <span class="b1"> {{
            infoObj3.completeCount
        }} </span> 次，已取消 <span class="b1"> {{ infoObj3.cancelTotal }} </span> 次，免除
        <span class="b1"> {{ infoObj3.cancelApplyCount }} </span> 次，待访谈 <span class="b1"> {{ infoObj3.waitDetectCount
        }} </span> 次
      </p>
    </div>
    <p class="pt">定期报告</p>
    <div>
      <p><span class="b1">{{ infoObj4.rulesTime }}</span>； </p>
      <p> 共需要做 <span class="b1"> {{ infoObj4.total }} </span> 次定期报告；已完成
        <span class="b1"> {{ infoObj4.completeCount }} </span> 次，未开始 <span class="b1"> {{ infoObj4.waitBeginCount
        }} </span> 次
      </p>
    </div>
  </j-modal>
</template>
<script>
import * as uroscopyApi from '@/api/sjsk/check/uroscopy.js'
import * as interviewApi from '@/api/sjsk/help/interview.js'
import * as estimateApi from '@/api/sjsk/estimate/list/index.js'

export default {
  name: 'detailModal',
  data() {
    return {
      visible: false,
      infoObj1: {},
      infoObj2: {},
      infoObj3: {},
      infoObj4: {}
    }
  },
  async created() {
  },
  methods: {
    show(record) {
      this.visible = true
      this.getUrineStatistical1(1, record.sjskPersonId) //常规尿检
      this.getUrineStatistical2(2, record.sjskPersonId)//突击尿检
      this.getInterviewStatistical(record.sjskPersonId) //定期访谈
      this.getReportStatistical(record.sjskPersonId) //定期报告
    },
    getDetail() {
      helpApi.viewActions(this.params).then(res => {
        if (res.success) {
          this.pageData = res.result
        }
      })
    },
    //常规尿检统计
    getUrineStatistical1(type, personId) {
      let params = {
        sjskPersonId: personId,
        urineType: type //检测类型（1-定期尿检；2-突击尿检；3-定期发检；4-突击发检）
      }
      uroscopyApi.sjskUrineStatistical(params).then((res) => {
        if (res.success) {
          this.infoObj1 = res.result ? res.result : {}
        }
      })
    },
    //突击尿检统计
    getUrineStatistical2(type, personId) {
      let params = {
        sjskPersonId: personId,
        urineType: type //检测类型（1-定期尿检；2-突击尿检；3-定期发检；4-突击发检）
      }
      uroscopyApi.sjskUrineStatistical(params).then((res) => {
        if (res.success) {
          this.infoObj2 = res.result ? res.result : {}
        }
      })
    },
    //定期访谈统计
    getInterviewStatistical(personId) {
      interviewApi.sjskInterviewStatistical({ sjskPersonId: personId }).then((res) => {
        if (res.success) {
          this.infoObj3 = res.result ? res.result : {}
        }
      })
    },
    //定期报告统计
    getReportStatistical(personId) {
      estimateApi.sjskReportStatistical(personId).then((res) => {
        if (res.success) {
          this.infoObj4 = res.result ? res.result : {}
        }
      })
    },
    handleCancel() {
      this.visible = false
    },
    handleOk() {
      this.visible = false
    }
  },
}
</script>
<style lang="less" scoped>
/deep/ .ant-modal-footer {
  display: flex;
  justify-content: space-between;
}

.pt {
  font-weight: bold;
  border-top: 1px dotted #ccc;
  padding-top: 15px;
}

.b1 {
  color: #1890FF;
}
</style>
